import config from 'config'
import httpFetch from 'share/httpFetch'

export default {

  //匹配组分页查询
  getMatchGroups(orgId, groupCode, groupName, page = 0, size = 10) {
    let params = {
      orgId, groupCode, groupName, page, size
    }
    return httpFetch.get(`${config.budgetUrl}/api/mapping/match/group`, params)
  },
  //匹配组添加
  addMatchGroups(params) {
    if (params.id) {
      return httpFetch.put(`${config.budgetUrl}/api/mapping/match/group`, params)
    } else {
      return httpFetch.post(`${config.budgetUrl}/api/mapping/match/group`, params)
    }
  },
  //项目映射动态匹配项查询
  getItemMappingByGroupId(groupId) {
    return httpFetch.get(`${config.budgetUrl}/api/mapping/match/items/${groupId}`)
  },
  //项目映射分页查询
  getItemMapping(params) {
    return httpFetch.get(`${config.budgetUrl}/api/budget/itemsMapping/selectByInput`, params)
  },
  //查询所有的匹配项目
  getAllMatchItems() {
    return httpFetch.get(`${config.budgetUrl}/api/mapping/match/items`)
  },
  //项目映射保存
  saveItemMapping(mappingData) {
    return httpFetch.post(`${config.budgetUrl}/api/budget/itemsMapping/insertOrUpdate`, {mappingData})
  },

  //删除项目映射-old
  deleteItemMap(params){
    return httpFetch.delete(`${config.budgetUrl}/api/budget/itemsMapping/deleteByIds`,params)
  },

  //导出项目映射明细数据
  exportItemMap(groupId) {
    return httpFetch.get(`${config.budgetUrl}/api/budget/itemsMapping/detail/attachment/export/${groupId}`)
  },

  //获取项目映射查询条件
  getHeaderCondition(groupId) {
    return httpFetch.get(`${config.budgetUrl}/api/mapping/match/items/${groupId}/?filterSrc=true`)
  },

}
